<template>
    <div class="add-equipment">
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>单位名称</label>
            </div>
            <div>
                <p>{{maintainItem.PartyName}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>项目名称</label>
            </div>
            <div>
                <p>{{maintainItem.ProjectName}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>设备类型</label>
            </div>
            <div>
                <p>{{maintainItem.EquipentType}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>自编号</label>
            </div>
            <div>
                <p>{{maintainItem.SelfNumbering}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>设备型号</label>
            </div>
            <div>
                <p>{{maintainItem.EquipentModel}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>设备编号</label>
            </div>
            <div>
                <p>{{maintainItem.RecordNumber}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>安装位置</label>
            </div>
            <div>
                <p>{{maintainItem.InstallationPosition}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>是否自有设备</label>
            </div>
            <div>
                <p>{{maintainItem.IsOwnEquipent}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>安装日期</label>
            </div>
            <div>
                <p>{{maintainItem.InstallationDate?maintainItem.InstallationDate.split(' ')[0]:''}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>上次维保日期</label>
            </div>
            <div>
                <p>{{maintainItem.LastMaintenanceDate?maintainItem.LastMaintenanceDate.split(' ')[0]:''}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>维保日期</label>
            </div>
            <div>
                <p>{{maintainItem.MaintenanceDate?maintainItem.MaintenanceDate.split(' ')[0]:''}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>维保单位</label>
            </div>
            <div>
                <p>{{maintainItem.MaintenanceDept}}</p>
            </div>
        </div>
        <div class="form-item form-item-style2">
            <div class="label-title">
                <label>参加维保人员</label>
            </div>
            <div>
                <p class="textarea">{{maintainItem.MaintenancePersonnel}}</p>
            </div>
        </div>
        <div class="cut-off-rule"></div>
        <div class="form-section">
            <h3 data-v-d3024438="">维护保养要求</h3>
            <div class="form-item form-item-style1"
                 v-for="(item,index) in maintainItem.dtCheckList"
                 v-bind:key="index">
                <div class="label-title label-title1">
                    <label>{{item.CheckPoint}}</label>
                </div>
                <div class="select-section">
                    <div :class='{"active":item.CheckResult == "符合要求"}'>
                        合格
                    </div>
                    <div :class='{"active":item.CheckResult != "符合要求"}'>
                        不合格
                    </div>
                </div>
            </div>
        </div>
        <div class="cut-off-rule"></div>
        <div class="form-section">
            <h3>
                附件信息
            </h3>
            <div class="form-item form-item-style1"
                 @click="preview(item.FilePath)"
                 v-for="(item,index) in maintainItem.FileName"
                 :key="index">
                <div class="label-title label-title1">
                    <label>附件</label>
                </div>
                <div class="right-section">
                    <span>预览</span>
                    <x-icon type="ios-arrow-right"
                            size="20"
                            class="icon-right"></x-icon>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>验证结论</label>
                </div>
                <div class="select-section">
                    <div :class="{'active':maintainItem.IsUse == '合格'}">
                        合格
                    </div>
                    <div :class="{'active':maintainItem.IsUse != '合格'}">
                        不合格
                    </div>
                </div>
            </div>
            <div class="form-item form-item-style2">
                <div class="label-title">
                    <label>验收意见</label>
                    <i class="iconfont icon-required"></i>
                </div>
                <div>
                    <p class="textarea">{{maintainItem.remark}}</p>
                </div>
            </div>
        </div>
        <myMenu></myMenu>
    </div>
</template>
<script>
import upload from '@/commonComponents/upload/index'
import myMenu from '@/commonComponents/menu'
export default {
    name: 'addEquipment',
    data () {
        return {
            maintainItem: '',
            regImg: /\.(png|jpg|PNG|JPG|jpeg|JPEG|gif|GIF)$/
        }
    },
    components: {
        upload,
        myMenu
    },
    created () {
        this.maintainItem = JSON.parse(localStorage.getItem('maintainItem'))
        localStorage.setItem('maintainItem', '')
    },
    methods: {
        preview (filePath) {
            if (this.regImg.test(filePath)) {
                this.$router.push({
                    path: '/previewImg',
                    query: {
                        previewImg: filePath
                    }
                })
            } else {
                wx.miniProgram.navigateTo({
                    url: `/pages/openDocument/index?filePath=${filePath}`
                })
            }
        }
    }
}
</script>
<style lang="less" scoped>
.select-section {
    display: flex;
}
.select-section div {
    padding-left: 26px;
    background: url(../../../../static/images/select.png) no-repeat left center;
    background-size: 17px 17px;
}
.select-section div:first-child {
    margin-right: 58px;
}
.select-section .active {
    background: url(../../../../static/images/selected.png) no-repeat left
        center;
    background-size: 17px 17px;
}
.add-equipment .label-title1 {
    width: 168px;
    line-height: 18px;
}
</style>
